//
//  UIBarButton+Extension.swift
//  SwiftSina
//
//  Created by 七 on 2017/4/17.
//  Copyright © 2017年 Apple. All rights reserved.
//

import UIKit
extension UIBarButtonItem{
    convenience init(imageName: String, target: Any?, action: Selector) {
        self.init()
        let button = UIButton()
        button.setImage(UIImage(named: imageName), for: .normal)
        button.setImage(UIImage(named: imageName + "_highlighted"), for: .highlighted)
        button.addTarget(target, action: action, for: .touchUpInside)
        button.sizeToFit()
        self.customView = button
    }
}
